package com.example.Extension.BeanFactoryPostProcessor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * @Description TODO
 * @Date 2024/6/3 0:19
 * @Created by houjunfeng
 */
@Component
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
    public void  postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)throws BeansException{
        System.out.println("MyBeanFactoryPostProcessor:..............");
        int count = beanFactory.getBeanDefinitionCount();
        System.out.println("当前bean的数量"+count);
        System.out.println(Arrays.asList(beanFactory.getBeanDefinitionNames()));
    }
}
